package com.dwjm.client;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/logout")
public class LogoutServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 让用户退出
        request.getSession().invalidate();  // 清除当前会话
        // 发送退出成功的响应
        response.setStatus(HttpServletResponse.SC_OK);
        response.getWriter().write("{\"code\":200, \"msg\":\"退出成功\"}");
    }
}
